package com.vng.zini.gifapp.activity;

import com.vng.zini.gifapp.activity.MainActivity;
import com.vng.zini.giffapp.R;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;

public class MainActivity extends Activity {
	private ImageButton btn_start_gif;
	MenuItem menuitem1;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		setButtonListener();
	}
	private void setButtonListener(){
		btn_start_gif = (ImageButton) findViewById(R.id.btn_start_gif);
		btn_start_gif.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent1 = new Intent(MainActivity.this, CameraActivity.class);
                startActivity(intent1);
			}
		});
	}
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		menu.clear();
		menuitem1 = menu.add("Test");
		return true;
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		
		if(item == menuitem1){
			Intent intent1 = new Intent(MainActivity.this, CameraActivity.class);
            startActivity(intent1);
		}

		return true;
	}
}
